/*
 * Copyright (c) 2020-2099 the original author or authors. All rights reserve.
 */
package org.tianyun.cloud.amqp.rabbitmq.configuration;

import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory.ConfirmType;

/**
 * RabbitMQ配置
 *
 * @auther ebert_chan
 */
public class RabbitMqProperties {

    /**
     * Comma-separated list of addresses to which the client should connect. When set, the host and port are ignored.
     */
    private String address;

    /**
     * Login user to authenticate to the broker.
     */
    private String username;

    /**
     * Login to authenticate against the broker.
     */
    private String password;

    /**
     * Virtual host to use when connecting to the broker.
     */
    private String virtualHost;

    /**
     * Maximum number of unacknowledged messages that can be outstanding at each consumer.
     */
    private Integer prefetch = 30;

    /**
     * Minimum number of listener invoker threads.
     */
    private Integer concurrency = 1;

    /**
     * Type of publisher confirms to use.
     */
    private ConfirmType publisherConfirmType = ConfirmType.CORRELATED;

    /**
     * Acknowledge mode of container.
     */
    private AcknowledgeMode acknowledgeMode = AcknowledgeMode.AUTO;

    // getter and setter

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getVirtualHost() {
        return virtualHost;
    }

    public void setVirtualHost(String virtualHost) {
        this.virtualHost = virtualHost;
    }

    public Integer getPrefetch() {
        return prefetch;
    }

    public void setPrefetch(Integer prefetch) {
        this.prefetch = prefetch;
    }

    public Integer getConcurrency() {
        return concurrency;
    }

    public void setConcurrency(Integer concurrency) {
        this.concurrency = concurrency;
    }

    public ConfirmType getPublisherConfirmType() {
        return publisherConfirmType;
    }

    public void setPublisherConfirmType(ConfirmType publisherConfirmType) {
        this.publisherConfirmType = publisherConfirmType;
    }

    public AcknowledgeMode getAcknowledgeMode() {
        return acknowledgeMode;
    }

    public void setAcknowledgeMode(AcknowledgeMode acknowledgeMode) {
        this.acknowledgeMode = acknowledgeMode;
    }

    /*
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "RabbitMqProperties [address=" + address + ", username=" + username + ", password=" + password + ", virtualHost=" + virtualHost + ", prefetch=" + prefetch
                + ", concurrency=" + concurrency + ", publisherConfirmType=" + publisherConfirmType + ", acknowledgeMode=" + acknowledgeMode + "]";
    }

}
